
	/**
	 * 将 appType appId appSign plaId tokenId 的值存入cookie
	 * @returns
	 */
	var appType = 'appType';
	var appId 	= 'appId';
	var appSign = 'appSign';
	var plaId 	= 'plaId';
	var tokenId = 'tokenId';
	var goId = 'goId';
	var upId = 'upId';
	var county = 'county';
	saveParamVal(appType);
	saveParamVal(appId);
	saveParamVal(appSign);
	saveParamVal(plaId);
	saveParamVal(tokenId);
	
	saveParamVal(goId);
	saveParamVal(upId);
	saveParamVal(county);
	
	/**
	 * 判断当前请求url中是否包含某个参数并将该参数的值存入cookie
	 * @param name
	 * @returns
	 */
	function saveParamVal(name) {
		var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
	    var r = window.location.search.substr(1).match(reg);
	    console.log(r);
	    if(r!=null) {
	    	document.cookie=name+"="+unescape(r[2])+";path=/";
	    }
	}
	
	/**
	 * js获取cookie值
	 * @param Name
	 * @returns
	 */
	function get_cookie(Name) {
		var search = Name + "="  // 查询检索的值
		var returnvalue = "";    // 返回值
		if (document.cookie.length > 0) {
			sd = document.cookie.indexOf(search);
			if (sd != -1) {
				sd += search.length;
				end = document.cookie.indexOf(";", sd);
				if (end == -1)
					end = document.cookie.length;
				// unescape() 函数可对通过 escape() 编码的字符串进行解码。
				returnvalue = unescape(document.cookie.substring(sd, end))
			}
		}
		return returnvalue;
	}

	// ajax访问 post地址,post参数,是否异步,返回函数
	function autoAjax(posturl,autodata,async,backfunction){
		$.ajax(getAjaxObject(posturl,autodata,async,backfunction));
	}
	
	//post Json的ajax
    function postJsonAjax(posturl,autodata,async,backfunction){
    	var ajaxObject= getAjaxObject(posturl,autodata,async,backfunction);
    	ajaxObject.contentType="application/json; charset=utf-8";
    	$.ajax(ajaxObject);
    }
    
    function getAjaxObject(posturl,autodata,async,backfunction){
        var ajaxObject= {  
              url:posturl,data:autodata,type:'post',cache:false,dataType:'json',async:async,
              success:function(data) {
            	  if(data.code=="0001"){
            		  setTimeout(function(){
            			  app.NativePage("userLogin",""); //tokenid失效，重新登录
            		  },200);
            	  } else {
            		  backfunction(true,data);
            	  }
              },  
              error : function(XMLHttpRequest, textStatus, errorThrown) {
                 backfunction(false,null);
              }  
        };
        return ajaxObject;
    }
	

	//获取get参数值
	function GetQueryString(name) {
	     var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
	     var r = window.location.search.substr(1).match(reg);
	     if(r!=null)return  unescape(r[2]); return null;
	}
	
	function appData(){
		var appType	= get_cookie("appType");
		var appId	= get_cookie("appId");
		var appSign	= get_cookie("appSign");
		var plaId   = get_cookie("plaId");
		var tokenId = get_cookie("tokenId");
		if(tokenId == ''){
			tokenId = GetQueryString('tokenId'); // 如果cookie中tokenId为空从请求中获取
		}
		var data = GetQueryString("data");
		return {appType:appType,appId:appId,appSign:appSign,plaId:plaId,tokenId:tokenId,data:data};
	}
	//截取显示后四位
	function subBankAccit(str){
		var str1=str;
		return str1.substring(str1.length-4,str1.length);
	}
	//截取显示前四位
	function subBankAccitindex(str){
		var str1=str;
		return str1.substring(0,5);
	}
	
	//截取显示前三位
	function subThreadphone(str){
		var str1=str;
		return str1.substring(0,4);
	}

	 function getBinkCode(bankid){
		 	var bankid=bankid;
			var bankname=[{
					"bankid":"1",
					"bankname":"中国工商银行"
				},
				{
					"bankid":"2",
					"bankname": "中国农业银行"
				},
				{
					"bankid":"3",
					"bankname": "中国银行"
				},
				{
					"bankid":"4",
					"bankname": "中国建设银行"
				},
				{
					"bankid":"5",
					"bankname": "交通银行"
				},
				{
					"bankid":"6",
					"bankname": "招商银行"
				},
				{
					"bankid":"7",
					"bankname": "中国邮政储蓄银行"
				},
				{
					"bankid":"8",
					"bankname": "浦东发展银行"
				},
				{
					"bankid":"9",
					"bankname": "中信银行"
				},
				{
					"bankid":"10",
					"bankname": "华夏银行"
				},
				{
					"bankid":"11",
					"bankname": "兴业银行"
				},
				{
					"bankid":"12",
					"bankname": "民生银行"
				},
				{
					"bankid":"13",
					"bankname": "平安银行"
				},
				{
					"bankid":"14",
					"bankname": "光大银行"
				},
				{
					"bankid":"15",
					"bankname": "广发银行"
				},
				{
					"bankid":"16",
					"bankname": "北京银行"
				},
				{
					"bankid":"17",
					"bankname": "上海银行"
				},
				{
					"bankid":"18",
					"bankname": "包商银行"
				},
				{
					"bankid":"19",
					"bankname": "深圳发展银行"
				},
				{
					"bankid":"20",
					"bankname": "广州银行"
				},
				{
					"bankid":"21",
					"bankname": "杭州银行"
				},
				{
					"bankid":"22",
					"bankname": "江苏银行"
				},
				{
					"bankid":"23",
					"bankname": "宁波银行"
				},
				{
					"bankid":"24",
					"bankname": "温州银行"
				},
				{
					"bankid":"25",
					"bankname": "南京银行"
				},
				{
					"bankid":"26",
					"bankname": "上海农商银行"
				},
				{
					"bankid":"27",
					"bankname": "花旗银行"
				},
				{
					"bankid":"28",
					"bankname": "山西农信社"
				}]
				for (var i = 0; i < bankname.length; i++) {
					if (bankname[i].bankid==bankid) {
						bankn= bankname[i].bankname;
					}
				}
				return bankn;
				}
	 function getBankLog(bankid){
		 	var bankid=bankid;
			var banklog=[{
					"bankid":"1",
					"bankname":"中国工商银行",
					"banklog":"../../images/fastcash/gs@2x.png"
				},
				{
					"bankid":"2",
					"bankname": "中国农业银行"
					,"banklog":"../../images/fastcash/ny@2x.png"
				},
				{
					"bankid":"3",
					"bankname": "中国银行"
					,"banklog":"../../images/fastcash/zg@2x.png"
				},
				{
					"bankid":"4",
					"bankname": "中国建设银行"
					,"banklog":"../../images/fastcash/zgjs@2x.png"
				},
				{
					"bankid":"5",
					"bankname": "交通银行"
					,"banklog":"../../images/fastcash/jiaotong@2x.png"
				},
				{
					"bankid":"6",
					"bankname": "招商银行"
					,"banklog":"../../images/fastcash/zhaoshang@2x.png"
				},
				{
					"bankid":"7",
					"bankname": "中国邮政储蓄银行"
					,"banklog":"../../images/fastcash/zgyz@2x.png"
				},
				{
					"bankid":"8",
					"bankname": "浦东发展银行"
					,"banklog":"../../images/fastcash/pf@2x.png"
				},
				{
					"bankid":"9",
					"bankname": "中信银行"
						,"banklog":"../../images/fastcash/zx@2x.png"
				},
				{
					"bankid":"10",
					"bankname": "华夏银行"
					,"banklog":"../../images/fastcash/hx@2x.png"
				},
				{
					"bankid":"11",
					"bankname": "兴业银行"
					,"banklog":"../../images/fastcash/xy@2x.png"
				},
				{
					"bankid":"12",
					"bankname": "民生银行"
					,"banklog":"../../images/fastcash/minshegn@2x.png"
				},
				{
					"bankid":"13",
					"bankname": "平安银行"
					,"banklog":"../../images/fastcash/ping@2x.png"
				},
				{
					"bankid":"14",
					"bankname": "光大银行"
					,"banklog":"../../images/fastcash/gd@2x.png"
				},
				{
					"bankid":"15",
					"bankname": "广发银行"
					,"banklog":"../../images/fastcash/gf@2x.png"
				},
				{
					"bankid":"16",
					"bankname": "北京银行"
					,"banklog":"../../images/fastcash/bj@2x.png"
				},
				{
					"bankid":"17",
					"bankname": "上海银行",
					"banklog":"../../images/fastcash/shanghai@2x.png"
					
				},
				{
					"bankid":"18",
					"bankname": "包商银行",
					"banklog":"../../images/fastcash/bs@2x.png"
					
				},
				{
					"bankid":"19",
					"bankname": "深圳发展银行",
					"banklog":"../../images/fastcash/szfz@2x.png"
				
				},
				{
					"bankid":"20",
					"bankname": "广州银行",
					"banklog":"../../images/fastcash/gz@2x.png"
					
				},
				{
					"bankid":"21",
					"bankname": "杭州银行",
					"banklog":"../../images/fastcash/hangzhou@2x.png"
					
				},
				{
					"bankid":"22",
					"bankname": "江苏银行",
					"banklog":"../../images/fastcash/js@2x.png"
				},
				{
					"bankid":"23",
					"bankname": "宁波银行",
					"banklog":"../../images/fastcash/nb@2x.png"
				},
				{
					"bankid":"24",
					"bankname": "温州银行",
					"banklog":"../../images/fastcash/wz@2x.png"
				},
				{
					"bankid":"25",
					"bankname": "南京银行",
					"banklog":"../../images/fastcash/nj@2x.png"
				},
				{
					"bankid":"26",
					"bankname": "上海农商银行",
					"banklog":"../../images/fastcash/shanghainongshang@2x.png"
				},
				{
					"bankid":"27",
					"bankname": "花旗银行",
					"banklog":"../../images/fastcash/hq@2x.png"
				},
				{
					"bankid":"28",
					"bankname": "山西农信社",
					"banklog":"../../images/fastcash/shanxinongxishe@2x.png"
				}]
				for (var i = 0; i < banklog.length; i++) {
					if (banklog[i].bankid==bankid) {
						banklog= banklog[i].banklog;
					}
				}
				return banklog;
				}

	 